﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using IDotNet.MapLibs.Web;
using Newtonsoft.Json;

namespace TestWebMap
{
    /// <summary>
    /// SaveMapAjax 的摘要说明
    /// </summary>
    public class SaveMapAjax : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            //跨域请求
            var jsoncallback = context.Request.QueryString["jsoncallback"];

            var data = new ChangeMapLocationResultInfo();
            data.msg = "保存成功！";

            var retData = string.IsNullOrWhiteSpace(jsoncallback)
                ? JsonConvert.SerializeObject(data)
                : string.Format("{0}({1})", jsoncallback, JsonConvert.SerializeObject(data));

            context.Response.ContentType = "text/javascript";
            context.Response.Write(retData);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }

}